<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/res/layui/css/layui.css" media="all">
    <style>
        .layui-form-checkbox span {
            line-height: 14px;
            color: #666;
            font-size: 14px;
        }
    </style>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: #FF5722">*</span> 商户名称</label>
        <div class="layui-input-block">
            <input type="text" name="username" lay-verify="required" placeholder="请输入商户名称" lay-reqtext="请输入商户名称" autocomplete="off" class="layui-input" value="{$merchant['username']}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: #FF5722">*</span> 手机号</label>
        <div class="layui-input-block">
            <input type="text" name="cellphone" lay-verify="required" placeholder="请输入手机号" lay-reqtext="请输入手机号" autocomplete="off" class="layui-input" value="{$merchant['cellphone']}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: #FF5722">*</span> 邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="email" lay-verify="required" placeholder="请输入邮箱" lay-reqtext="请输入邮箱" autocomplete="off" class="layui-input" value="{$merchant['email']}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码 </label>
        <div class="layui-input-inline">
            <input type="password" name="password" placeholder="请输入登录密码" autocomplete="off" class="layui-input" value="">

        </div>
        <div class="layui-form-mid layui-word-aux"> 不输入，则不修改密码</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">确认密码 </label>
        <div class="layui-input-inline">
            <input type="password" name="confirm_password" placeholder="请再次输入密码" autocomplete="off" class="layui-input" value="">
        </div>
        <div class="layui-form-mid layui-word-aux"> 不输入，则不修改密码</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: #FF5722">*</span> 角色 </label>
        <div class="layui-input-block" id="role_ids">

        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">企业 </label>
        <div class="layui-input-block">
            <select name="enterprise_id"  lay-search="">
                <option value="">直接选择或搜索选择</option>
                {foreach $enterprises as $enterprise}
                <option value="{$enterprise['id']}" {if $enterprise['id'] eq $merchant['enterprise_id']}selected{/if}>{$enterprise['name']}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: #FF5722">*</span> 状态</label>
        <div class="layui-input-block">
            <input type="checkbox" {if $merchant['status'] eq 1}checked{/if} lay-verify="required" lay-filter="status" name="status" lay-skin="switch" lay-text="启用|禁用" value="1">
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <input type="hidden" value="{$merchant['id']}" name="id" />
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
    </div>
</div>

<script src="__STATIC__/res/layui/layui.js"></script>
<script>
    layui.config({
        base: '__STATIC__/res/' //静态资源所在路径
    }).use(['index', 'form','selectM'],function(){
        var $ = layui.$
            ,form = layui.form
            ,selectM = layui.selectM;

        //多选标签-基本配置
        selectM({
            //元素容器【必填】
            elem: '#role_ids'
            //候选数据【必填】
            ,data: JSON.parse('{$roles|raw}')
            ,max:5
            // ,width:400
            //添加验证
            ,verify:'required'
            ,selected:JSON.parse("{$merchant['role_ids']|raw}")
        });
    })
</script>
</body>
</html>